const Koa = require('koa')
const app = new Koa()
const koaBody = require('koa-body')
const router = require('./api/index')
// const jwt = require('koa-jwt')
const tokenVerify = require('./middleware/token-verify')
const config = require('./config')

router.get('/', (ctx, next) => {
    ctx.body = 'Hello Koa!'
})

app
	.use(tokenVerify)
	// .use(jwt({secret:config.app.secret}).unless({
	// 	//不需要权限认证的API
	// 	path: ['/login', '/logout']
	// }))
	.use(koaBody())
    .use(router.routes())
    .listen(3002)
console.log('app started at: http://localhost:3002')